package com.yellow.orderservice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yellow.orderservice.entity.Order;
import com.yellow.orderservice.entity.Receiver;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ReceiverMapper extends BaseMapper<Receiver> {

    @Select("SELECT o.* FROM orders o " +
            "INNER JOIN customer_orders co ON o.order_id = co.order_id " +
            "INNER JOIN receiver r ON co.customer_id = r.receiver_id " +
            "WHERE r.name = #{name}")
    List<Order> getOrdersByReceiverName(String name);
}
